<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<div id="app">
    <input type="button" value="切换显示状态" @click="changeIsShow">
    <input type="button" value="年岁增长" @click="addAge">
    <p>我今年{{age}}岁了</p>
    <img v-show="isShow" src="../img/zyeb.jpg">
    <p v-if="age>=18">枕上诗书闲处好</p>
    <p v-if="age>=19">门前风景雨来佳</p>
    <p v-if="age>=20">朝暮与年岁并往</p>
    <p v-if="age>=21">然后与你一同行至天光</p>
<!--    切换多个元素的显示-->
    <template v-if="ok">
        <h1>Title</h1>
        <p>Paragraph 1</p>
        <p>Paragraph 2</p>
    </template>
</div>
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
<script>
    var app = new Vue({
        el:'#app',
        data:{
            isShow:false,
            age:17
        },
        methods:{
            changeIsShow:function () {
                this.isShow = !this.isShow;
            },
            addAge:function () {
                this.age++;
            }
        }
    })

</script>
</body>
</html>